package com.liu.controller;

import com.liu.shop.common.constant.AuthConstants;
import com.liu.shop.common.vo.UserVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import javax.servlet.http.HttpSession;

@Controller
public class HomeController {

    /**
     * 用户成功登录后将登录信息通过springSession存入redis中
     * 测试通过springSession来获取redis中的session
     * @param session
     */
    @GetMapping("/test")
    public void test(HttpSession session){
        UserVo userVo = (UserVo) session.getAttribute(AuthConstants.LOGIN_USER);
        System.out.println(userVo);
    }

    @GetMapping("/toIndex")
    public String toIndex(){
        System.out.println("HomeController.toIndex");
        return "index";
    }

}
